package com.ruoyi.web.wrapper;

import cn.hutool.core.util.ObjectUtil;
import com.ruoyi.account.enums.ApplyStatusEnum;
import com.ruoyi.laiqianba.enums.AccountTypeEnum;
import com.ruoyi.account.enums.ActionTypeEnum;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.wrapper.BaseControllerWrapper;

import java.util.List;
import java.util.Map;

public class AccountApplyRecordWrapper extends BaseControllerWrapper {

    public AccountApplyRecordWrapper(Map<String, Object> single) {
        super(single);
    }

    public AccountApplyRecordWrapper(List<Map<String, Object>> multi) {
        super(multi);
    }

    @Override
    public void wrapTheMap(Map<String, Object> map) {
        try {


            //账户类型
            String itemAccountType = map.get("itemAccountType").toString();
            if (StringUtils.isNotEmpty(itemAccountType)){
                map.put("itemAccountTypeEnumName", AccountTypeEnum.getNameByValue(itemAccountType));
            }
            //操作类型
            String actionType = map.get("actionType").toString();
            if (StringUtils.isNotEmpty(actionType)){
                map.put("actionTypeEnumName", ActionTypeEnum.getNameByValue(actionType));
            }

            //操作类型
            Integer status = (Integer) map.get("status");
            if (ObjectUtil.isNotEmpty(status)){
                map.put("statusStr", ApplyStatusEnum.getNameByValue(status));
            }
        }catch (Exception ex){
            ex.printStackTrace();
        }
    }
}
